#include <RCSwitch.h>

// ********************************************************
// 中断1与中断2无法同时使用切记
// ********************************************************

// 433接收端
// 这个针角对应的是终断0,1,arduion uno只有两个中断0,1对应pin,2,3
int pinRec315 = 0;
int pinRec433 = 1;

int led = 1;

long serialSpeed = 115200;

// 315接收遥控对象
RCSwitch switch315Rec = RCSwitch();

// 433接收遥控对象
RCSwitch switch433Rec = RCSwitch();


void setup() {
  Serial.begin(serialSpeed);
  pinMode(pinRec315, INPUT);
  pinMode(pinRec433, INPUT);
  pinMode(led, OUTPUT);

  // 这个针角对应的是终断0,1,arduion uno只有两个中断0,1对应pin,2,3
  switch315Rec.enableReceive(pinRec315);
  switch433Rec.enableReceive(pinRec433);
}


void loop() {
  if (switch315Rec.available()) {
    int rec315 = switch315Rec.getReceivedValue();
    if (rec315 > 0) {
      Serial.print("Receive Code 315: ");
      Serial.println(rec315);
    }
    switch315Rec.resetAvailable();
  }

  if (switch433Rec.available()) {
    int rec433 = switch433Rec.getReceivedValue();
    if (rec433 > 0) {
      Serial.print("Receive Code 433: ");
      Serial.println(rec433);
    }
    switch433Rec.resetAvailable();
  }

}
